package com.beiding.service.storage;

import com.beiding.pojo.room.Room;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class ErrorFallBack implements FallbackFactory<RoomStorageService> {

    @Override
    public RoomStorageService create(Throwable cause) {

        return new RoomStorageService() {
            @Override
            public Room put(Room room) {

                System.out.println(cause);

                System.out.println("出现异常");

                return room;
            }

            @Override
            public Room update(Room room) {
                return room;
            }

            @Override
            public void remove(String id) {

                System.out.println(cause.getMessage());

            }

            @Override
            public Room get(String id) {
                return null;
            }
        };

    }
}